import { createStore, createLogger } from 'vuex'
import createPersistedstate from 'vuex-persistedstate'

// 导入模块
import user from './modules/user'
import cart from './modules/cart'
import category from './modules/category'

export default createStore({
  getters: {
    getToken (state) {
      return state.user.profile.token
    }
  },
  modules: { user, cart, category },
  plugins: [
    createPersistedstate({
      key: 'erabbit-client-pc-store',
      paths: ['user', 'cart']
    }),
    createLogger()
  ]
})
